# -*- coding: utf-8 -*-
from core import consts
from core.http import http_client

consts.ROOT_URL = "http://127.0.0.1:8881/service-bill/v0/callBillApi"


def _test_saveMsgCdr():
    api = "/saveMsgCdr"
    url = consts.ROOT_URL + api

    data = {
        "MsgID": "CallCDRIndi",
        "ModuleID": "121",
        "MsgTime": "2019-09-26 09:55:46.477",
        "CdrID": "626718476609781763",
        "pin": "8618923714596",
        "SetupTime": "2019-09-26 09:55:29.090",
        "OutCallTime": "2019-09-26 09:55:33.957",
        "AlertTime": "2019-09-26 09:55:34.031",
        "AnswerTime": "2019-09-26 09:55:35.732",
        "ReleaseTime": "2019-09-26 09:55:46.477",
        "Caller": "18923714596",
        "Called": "90000001",
        "origCaller": "18923714596",
        "origCalled": "90000001",
        "CodecType": "0",
        "pTime": "20",
        "StatusCode": "0",
        "CallType": "O",
        "DropCallAttr": "0",
        "TalkLen": "12",
        "CallLength": "13",
        "reserved": "172.26.228.85"
    }

    return http_client.post(url=url, data=data, token="")


def test():
    _test_saveMsgCdr()


if __name__ == "__main__":
    test()
